home *** CD-ROM | disk | FTP | other *** search
/ BBS in a Box 7 / BBS in a Box - Macintosh - Volume VII (BBS in a Box) (January 1993).iso / Files / Tele / T / Terminal 1.7.cpt / Terminal scripts / Log into ComNet.s < prev    next >
Text File  |  1989-11-06  |  1KB  |  54 lines

  1. /*
  2.     Terminal 1.7
  3.     "Log into ComNet.s"
  4. */
  5.  
  6. /* ----- Send command and wait for reply ------------------------------- */
  7.  
  8. check(char *command, char *reply)
  9. {
  10.     type(command);
  11.     return prompt(reply, 1800);    /* Timeout = 30 sec */
  12. }
  13.  
  14. /* ----- Wait for prompt and send command ------------------------------ */
  15.  
  16. answer(char *hint, char *command)
  17. {
  18.     int result;
  19.  
  20.     if (result = prompt(hint, 1800))
  21.         return result;    /* Timeout or cancel */
  22.     pause(30);            /* Don't type immediatly */
  23.     type(command);
  24.     return 0;
  25. }
  26.  
  27. /* ----- main program -------------------------------------------------- */
  28.  
  29. main()
  30. {
  31.     int go = 1;
  32.  
  33.     while (go) {
  34.         if (check("ATDP22534\r", "CONNECT"))    /* Dial */
  35.             break;
  36.         if (answer("Return", "\r"))                /* Wait for "Hit Return" */
  37.             break;
  38.         if (answer("<RETURN>", "\r"))            /* Select Graphics Style */
  39.             break;
  40.         if (answer("User", "2001604\r"))        /* Enter ID Number */
  41.             break;
  42.         if (answer("Password", "...\r"))        /* Enter password */
  43.             break;
  44.         go = 0;            /* Ok */
  45.     }
  46.     if (go) {        /* Timeout or cancel */
  47.         setdtr(0);    /* Negate DTR: modem hangs up */
  48.         pause(60);    /* Wait one second */
  49.         setdtr(1);    /* Assert DTR: now back in command mode */
  50.         beep();        /* 2 beeps if error */
  51.     }
  52.     beep();
  53. }
  54.